package com.nettyRpc.consumer.netty;

import com.nettyRpc.api.DubboResult;
import com.nettyRpc.consumer.DubboFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * 监听返回结果-
 */

public class DubboChannelHandler extends SimpleChannelInboundHandler<DubboResult> {

    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, DubboResult result) {
        //监听接收请求- DubboResult(id=100, data=Hello World你好 呀 我已经进来了 哈哈哈)
        DubboFuture.received(result);

    }
    // ChannelHandlerContext(DubboChannelHandler#0, [id: 0x3f770713, L:/127.0.0.1:58188 - R:/127.0.0.1:8088])
    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
        //获取通道
        super.channelActive(ctx);
    }

    @Override
    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
        super.channelInactive(ctx);
    }
}
